#include <STC15F2K60S2.H>
#include "smg.h"
#include "Timer0.h"
#include "KeyTimer.h"

unsigned char KeyNum;	//不能取KeyNum,重名会报错！
unsigned char Number;
void main()
{
	All_Init();
	Timer0_Init();
	
	while(1)
	{
		KeyNum = GetKey_Num();
		if (KeyNum == 7) Number++;
		if (KeyNum == 6) Number--;
		if (KeyNum == 5) Number+=10;
		if (KeyNum == 4) Number-=10;	
		
		Nixie(1, Number/10);
		Nixie(2, Number%10);
	}
}

//定时器0中断服务子函数
void Timer0_Rountine(void) interrupt 1
{	//1ms
	static unsigned int T0Count;
	static unsigned int anjian;
	
	T0Count++;
	anjian++;
	
	if (anjian >= 10)	//10ms扫描一次按键
	{
		KeyScan();
		anjian = 0;	//软件复位
	}
}	
